<?
#if ($_SERVER[REMOTE_ADDR] != '213.222.51.231') exit("Service temporary down for upgrade. Will be up again in 30 minutes.<br>Please excuse us for any inconveniance!");
//global $pg_host, $pg_password, $pg_username, $pg_db;
include_once('../variables.php');
//echo "<!--host: $pg_host\n-->";
$dbpass = $pg_password; //"w9JwRoA";
$dbuser = $pg_username; //"root";
$dbname = $pg_db; //"rp2";
$dbhost = $pg_host; //"209.25.134.4";

if(!$dbh81 = pg_connect("dbname=$dbname host=$dbhost user=$dbuser password=$dbpass")) {
  $errorMsg = translate('cannot_process_request');
	include_once('errorMsg.html');
	exit;
}
//exit('Error Processing your request');

// pishem malka funkciika za prashtane na mailz za da si ulesnim zhivota...

function mail2reseller($id,$message,$subject='Settings changed') {
	GLOBAL $dbh81;
	if (empty($id)) return FALSE;
	if (empty($message)) return FALSE;
	$sql="SELECT first_name, last_name, email FROM resellers WHERE reseller_id='$id'";
	$result=pg_query($dbh81,$sql) or die("ERROR!");
	$first_name=pg_fetch_result($result,0,'first_name');
	$last_name=pg_fetch_result($result,0,'last_name');
	$email=pg_fetch_result($result,0,'email');
	$msg="Dear $first_name $last_name,\n\n";
	$msg.=$message;
	$msg.="\nIf this change is unauthorized, please contact our support team immediately!\n\nBest Regards,\nResellersPanel Team";
	$header="From: support@resellerspanel.com";
	if (mail($email,$subject,$msg,$header)) {
		return TRUE;
	} else {
		return FALSE;
	}
}
?>
